Skip to content

[Rest] Clamp non-finite Retry-After values - #1615

Merged
gonchik merged 1 commit into
atlassian-api:masterfrom
star7js:fix/retry-after-clamp
Aug 15, 2026
Merged

[Rest] Clamp non-finite Retry-After values#1615
gonchik merged 1 commit into
atlassian-api:masterfrom
star7js:fix/retry-after-clamp

Conversation

@star7js

@star7js star7js commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add unit test for non-finite Retry-After handling.
  • Clamp non-finite Retry-After values (e.g., 1e309inf) to max_backoff_seconds.

What Goes Wrong Today

  • The library parses Retry-After as a number.
  • Extremely large values can become inf, which can break or cause unrealistic sleep behavior.

What The Fix Does

  • After parsing, checks whether the value is finite.
  • If not finite, clamps it to max_backoff_seconds.
  • Uses the safe value for time.sleep.

Why This Is Safe

  • The library already clamps large finite values to max_backoff_seconds.
  • inf is just “beyond large”; clamping keeps behavior consistent.
  • Preserves intended semantics: wait, but not forever.

Tests

  • pytest -q tests/test_rest_client.py -k "retry_handler"

@gonchik
gonchik merged commit 0ba711a into atlassian-api:master Aug 15, 2026
4 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants